<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      padding: 0;
      margin: 0;
    }

    .parent {
      overflow: auto;
      width: 400px;
      height: 400px;
      padding: 100px;
      background-color: rgba(0, 110, 255, 0.5);
    }

    .child {
      width: 500px;
      height: 100px;
    }

    .child:nth-child(1) {
      background-image: linear-gradient(to right, red, orange);
    }

    .child:nth-child(2) {
      background-image: linear-gradient(to right, orange, yellow);
    }

    .child:nth-child(3) {
      background-image: linear-gradient(to right, yellow, green);
    }

    .child:nth-child(4) {
      background-image: linear-gradient(to right, green, cyan);
    }

    .child:nth-child(5) {
      background-image: linear-gradient(to right, cyan, blue);
    }

    .child:nth-child(6) {
      background-image: linear-gradient(to right, blue, purple);
    }

    .child:nth-child(7) {
      background-image: linear-gradient(to right, purple, red);
    }
  </style>
</head>

<body>
  <div class="parent">
    <div class="child"></div>
    <div class="child"></div>
    <div class="child"></div>
    <div class="child"></div>
    <div class="child"></div>
    <div class="child"></div>
    <div class="child"></div>
  </div>

  <button>滚动到底部</button>

  <script>
    const elem = document.querySelector('.parent')

    function onClick() {
      // 滚动到底部
      elem.scrollTop = elem.scrollHeight
    }

    document.querySelector('button').addEventListener('click', onClick)
  </script>
</body>

</html>